package com.mobjam.workingtitleforagame;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

	Button mapActivityButton;
	Button helpButton;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        mapActivityButton = (Button) findViewById(R.id.button1);
        mapActivityButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	Intent myIntent = new Intent(v.getContext(), MapActivity.class);
                startActivityForResult(myIntent, 0); 
            }
        });
        
        helpButton = (Button) findViewById(R.id.button2);
        helpButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	showDialog(0);
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    @Override
    protected Dialog onCreateDialog(int id) {
    	switch (id) {
    	case 0:
    		return new AlertDialog.Builder(this)
    		.setTitle("Controls")
    		.setPositiveButton("OK", new DialogInterface.OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					
				}
			})
			.setMessage("1. Single-tap to move character.\n2. Longpress and Drag to move character.\n" +
						"3. Swipe to move the map.\n4. Pinch-open or Pinch-close to zoom-in or zoom-out.\n" +
						"5. Double-tap to zoom in or out.")
    		.create();
    	}
    	return null;
    }
}
